package fr.umlv.rtsjtaskserver.server;

import java.util.ArrayList;
import java.util.List;

import javax.realtime.ArrivalTimeQueueOverflowException;
import javax.realtime.AsyncEvent;
import javax.realtime.MITViolationException;

public class ServableAsyncEvent extends AsyncEvent {
	private final List<ServableAsyncEventHandler> handlers = new ArrayList<ServableAsyncEventHandler>();
	
	public void addHandler(ServableAsyncEventHandler handler) {
		this.handlers.add(handler);
	}
	
	@Override
	public void fire() throws MITViolationException,
			ArrivalTimeQueueOverflowException {
		
		for(ServableAsyncEventHandler handler : this.handlers){
			handler.handleServableAsyncEvent(this);
		}
	}
	
	
}
